﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using IQKS.AWP.BusinessObject;
using System.Web.Security;

namespace IQKS.AWP.DataAccessLayer
{
  public  class CandidateDetailsDAL
    {
        public DataSet GetCandidateDetails(params object[] param)
        {
            DataSet objDs;

            try
            {
                objDs = DataUtils.ExecuteDataset("Usp_GetCandidateDetailsByStatusID", param);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }


        public object SetCandidateDetails(params object[] param)
        {
            try
            {
                return DataUtils.ExecuteScalar("Usp_SetCandidateRegistrationApproval", param);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
        public object SetCandidateRegistrationReject(params object[] param)
        {
            try
            {
                return DataUtils.ExecuteScalar("Usp_SetCandidateRegistrationReject", param);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }

        //public object SetCandidateStatusDAL(params object[] param)
        //{
        //    try
        //    {
        //        return DataUtils.ExecuteScalar("Usp_SetCandidateStatus", param);
        //    }
        //    catch (Exception ex)
        //    {
        //        throw new ApplicationException(ex.Message);
        //    }
        //}
        public DataSet GetStatus(params object[] param)
        {
            try
            {
                return DataUtils.ExecuteDataset("Usp_GetStatusMaster", param);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }


        public DataSet GetUserDetailByEmailID(params object[] param)
        {
            DataSet objDs;

            try
            {
                objDs = DataUtils.ExecuteDataset("USP_GetUserRegistrationByEmail", param);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }


        public DataSet GetAccrediationCompletedCandidates(int regionID,int countryID)
        {
            DataSet objDs;

            try
            {
                SqlParameter[] parameters = new SqlParameter[]
                {
                    new SqlParameter("@RegionID",regionID),
                    new SqlParameter("@countryid",countryID)
                };
                objDs = DataUtils.ExecuteDataset("Usp_GetAccrediationCompletedCandidates", parameters);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }
        public object SetCandidateInvoice(params object[] param)
        {
            try
            {
                return DataUtils.ExecuteScalar("Usp_SetCandidateInvoiceByCandidateId", param);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
    }
}
